package com.iotp.service.userOrgRef;

import com.iotp.dao.userOrgRef.UserOrgRefDAO;
import com.iotp.entity.userOrgRef.UserOrgRef;
import com.iotp.service.base.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * 用户-机构-关联业务接口实现类
 * @author Assassin
 */
@Service("userOrgRefService")
public class UserOrgRefServiceImpl extends BaseServiceImpl implements UserOrgRefService {

	// Fields

	@Autowired
	private UserOrgRefDAO userOrgRefDAO;// 用户-机构-关联DAO接口

	// Methods

   /**
	* 添加用户-机构-关联
	* @param refId 标识信息-关联Id[主键值]
	* @param userId 关联信息-用户Id
	* @param orgId 关联信息-机构Id
	* @return Long refId 添加后的数据库主键值
	*/
	@Override
	public Long add(Long refId, Long userId, Long orgId) {
		// 构造用户-机构-关联参数实体
		UserOrgRef userOrgRef = new UserOrgRef();
		userOrgRef.setRefId(refId);// Set 标识信息-关联Id[主键值]
		userOrgRef.setUserId(userId);// Set 关联信息-用户Id
		userOrgRef.setOrgId(orgId);// Set 关联信息-机构Id
		// 调用用户-机构-关联DAO接口
		this.userOrgRefDAO.insert(userOrgRef);
		return userOrgRef.getRefId();
	}
	
}